/*
 * Copyright 2010 JooKar (info@jookar.nl)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.jookar.gcodecommithook.model;

import java.util.LinkedList;
import java.util.List;

/**
 * @author Joost A. Bloemsma
 *
 */
public class Commit {
	private String project_name;
	private String repository_path;
	private int revision_count;
	private List<Revision> revisions = new LinkedList<Revision>();
	/**
	 * @return the project_name
	 */
	public String getProjectName() {
		return project_name;
	}
	/**
	 * @param project_name the project_name to set
	 */
	public void setProjectName(String project_name) {
		this.project_name = project_name;
	}
	/**
	 * @return the repository_path
	 */
	public String getRepositoryPath() {
		return repository_path;
	}
	/**
	 * @param repository_path the repository_path to set
	 */
	public void setRepositoryPath(String repository_path) {
		this.repository_path = repository_path;
	}
	/**
	 * @return the revision_count
	 */
	public int getRevisionCount() {
		return revision_count;
		
	}
	/**
	 * @param revision_count the revision_count to set
	 */
	public void setRevisionCount(int revision_count) {
		this.revision_count = revision_count;
	}
	/**
	 * @return the revisions
	 */
	public List<Revision> getRevisions() {
		return revisions;
	}
	/**
	 * @param revisions the revisions to set
	 */
	public void setRevisions(List<Revision> revisions) {
		this.revisions = revisions;
		this.revision_count = this.revisions != null?this.revisions.size():0; 
	}
	
	/**
	 * @param rev {@link Revision} to add
	 */
	public void addRevision(Revision rev) {
		this.revisions.add(rev);
		this.revision_count = this.revisions != null?this.revisions.size():0;
	}
}
